/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JDialog;

/**
 *
 * @author Daniel
 */
public class DialogkeyListener implements KeyListener {
   private JDialog dialog;

    public DialogkeyListener(JDialog dilog) {
        this.dialog = dilog;
    }      
    
   public void keyTyped(KeyEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
       // System.out.println("typed " + e.getKeyCode());
    }

    public void keyPressed(KeyEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
        //System.out.println("pressed " + e.getKeyCode());
          if (e.getKeyCode() == KeyEvent.VK_ESCAPE){
              dialog.setVisible(false);
          }            
    }

    public void keyReleased(KeyEvent e) {
        //System.out.println("released " + e.getKeyCode());
        //throw new UnsupportedOperationException("Not supported yet.");
    }
}
